<?php echo $this->Html->css('form'); ?>
<?php echo $this->Html->script('modify_image'); ?>
<div class="contentMain">
	<div class="grayBox">
		<div class="form_wrapper">
			<div class="title">Edit Profile</div>
			<ul class="editBox">
				<?
					echo $this->Form->create('User', array('action' => 'profile', 'enctype' => 'multipart/form-data'));
				?>
				<li>
					<span class="titleName"><label>Name</label></span>
					<?
						echo $this->Form->input('name', array('label'=>false,'div'=>false));
					?>
				</li>
				<li>
					<label class="titleName">Email</label>
					<span class="ans">
					<?=$this->data['User']['username'];?></span>
				</li>
				
				<li>
					<label class="titleName">Gender</label>
					<span id="radio_group" class="ans">
						<?
							$options=array('1'=>'Male','2'=>'Female');
							$attributes=array('legend'=>false);
							echo $form->radio('gender',$options,$attributes);
						?>
					</span>
				</li>
				<li>
					<label class="titleName">Birthday</label>
					<span class="ans birthday">
					<?
						echo $form->input('birthday', array(
							'type'=>'date', 
							'empty'=>true, 
							'minYear'=>1940, 
							'maxYear'=>2010, 
							'class'=>'text', 
							'div'=>false,  
							'label'=>false, 
							'separator' => '&nbsp;',
							'style'=>'width: 100px;'));
					?>
					</span>
				</li>
				<li>
					<label class="titleName">Avatar</label>
					<span class="ans">
						<?
							echo $form->file('image_form', array('onchange' => 'modify_image(this, "showAvatar")'));
							if(isset($this->data['User']['error']) && $this->data['User']['error'])
							{
								echo('<div class="error-message" style="margin-left:5px">'.$this->data['User']['error'].'</div>');
							}
						?>
						
						<span class="smallText">File type JPG, PNG or GIF only and Maximum of 500kb.</span>
						<span>
							<?=$html->image($thumb->image($this->data['User']['avatar']),array(
								'id' => 'showAvatar',
								'style' => 'width:195px;margin:15px 240px'));?>
						</span>
					</span>
				</li>
			</ul>		
			
			<div id="button_wrapper" style="margin-left:25.5%">
				<div style="float:left">
					<?
						echo $this->Form->end(array(
							'label'=>'Save',
							'class'=>'button',
							'div'=>false
							));
					?>
				</div>
				&nbsp;
				<input type="submit" value="Cancel" onclick="window.location='<?=$this->webroot?>users/view/<?=$user_id?>'">
			</div>
		</div>
	</div>
</div>
